package com.hsgene.order.constants;

/**
 * 发票类型枚举
 *
 * @author wangbing
 * @version 1.0, 2018/8/3
 */
public enum InvoiceType {

    PAPER("paper", "普通纸质发票"),

    ELECTRONIC("electronic", "普通电子发票"),

    UNDEFINED("undefined", "未定义的发票类型");

    /**
     * 编码
     */
    private final String code;

    /**
     * 描述
     */
    private final String desc;

    public static InvoiceType getEnum(String code) {
        for (InvoiceType type : values()) {
            if (type.code.equalsIgnoreCase(code)) {
                return type;
            }
        }
        return UNDEFINED;
    }

    InvoiceType(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public String getCode() {

        return code;
    }
}
